export const getStatusBarHeight = () => {
	// 获取系统信息
	const systemInfo = uni.getSystemInfoSync();
	return systemInfo.statusBarHeight || 0;
}


export const getNavBarHeight = () => {
	// 判断是否存在
	if (uni.getMenuButtonBoundingClientRect) {
		const {
			top,
			height
		} = uni.getMenuButtonBoundingClientRect();
		const statusBarHeight = getStatusBarHeight();
		const menuMargin = (top - statusBarHeight) * 2;
		const navBarHeight = menuMargin + height;
		return navBarHeight;
	} else {
		return 40;
	}
}

export const getFillHeight = () => {
	// 判断是否存在
	if (uni.getMenuButtonBoundingClientRect) {
		const {
			top,
			height
		} = uni.getMenuButtonBoundingClientRect();
		const statusBarHeight = getStatusBarHeight();
		const menuMargin = (top - statusBarHeight) * 2;
		const fillHeight = statusBarHeight + menuMargin + height;
		return fillHeight;
	} else {
		return 40;
	}
}

export const getWindowSize = () => {
	const {
		windowHeight,
		windowWidth
	} = uni.getSystemInfoSync();
	return {
		windowHeight,
		windowWidth
	}
}